﻿#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main() {
	int year = 0;
	int month = 0;
	int day = 0;
	int i = 0;
	int sum = 0;
	scanf("%d %d %d", &year, &month, &day);

	//定义数组，存放相应月份的日数（其中二月存放28）
	int month_day[13] = { 0,31,28,31,30,31,
	30,31,30,31,31,30,31 };
	//进行日期计算
	for (i = 1; i < month; i++)
		sum += month_day[i];
	if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
	{
		if (month > 2)
			sum += day + 1;
		else
			sum += day;
	}
	else
		sum += day;
	//输出
	printf("%d", sum);

	return 0;
}